<template>
  <div class="main">
    <div class="banner"></div>
    <div class="list">
      <span class="release_time">发布时间:{{details.createdAt | timeFormat}}</span>
      <span class="read_amount">阅读量:{{details.readingAmount}}</span>
      <span class="go_Back" @click="goBack">返回 >></span>
    </div>
    <div class="content">
      <p>{{details.title}}</p>
      <p v-html="content"></p>
    </div>
  </div>
</template>
<style>
  .main {
    width: 90%;
    margin-left: 5%;
  }
  .banner {
    width: 100%;
    height: 150px;
    background: url("../images/detail_banner.jpg");
    background-position: center;
    background-size: 100% 200px;
  }
  .list{
    width: 100%;
    height: 40px;
    background: rgba(231,231,231,0.2);
    border-bottom: 1px solid rgba(221,221,221,0.5);
    /*text-align: right;*/
  }
  .list span{
    line-height: 40px;
    font-size: 12px;
    color: #6c757d;
    margin-right: 10px;
    justify-content: space-between;
  }
  .release_time{
    margin-left: 5px;
  }
  .read_amount{
    margin-left: 15px;
  }
  .go_Back{
    margin-left: 20px;
  }
  .content{
    margin-top: 20px;
    padding-bottom: 20%;
  }
  .content p{
    font-size: 12px;
    color: #6c757d;
  }
  .content table{
    border: 1px solid #000;
    text-align: center;
  }
  .content table th{
    border: 1px solid #777777;
    text-align: center;
  }
  .content table td{
    border: 1px solid #777777;
  }

</style>
<script>
  import {getDetail} from 'http/article.js'

  export default {
    name: 'noticeDetail',
    data() {
      return {
        details:{},
        content:''
      }
    },
    created (){
      this._getDetail()
    },
    methods: {
      goBack () {
         this.$router.go(-1)
      },
      _getDetail(){
        getDetail(this.$route.params.id).then((res)=>{
//          console.log(res)
          this.details=res
          this.content = res.content.replace(/&nbsp;/g, '')
        })
      }
    }
  }
</script>
